package com.boboPlanet.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.boboPlanet.comm.entity.po.LoginUserInfoPO;
import com.boboPlanet.user.entity.dto.UpdateUserInfoDTO;
import com.boboPlanet.user.entity.vo.CurrentUserInfoVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Description: TODO
 * @Author: mis_wu
 * @Date: 2023/2/14
 **/
@Mapper
public interface UserOperationMapper extends BaseMapper<LoginUserInfoPO> {

    LoginUserInfoPO queryLoginUserInfoByAccount(@Param("account") String account);

    LoginUserInfoPO queryLoginUserInfoByToken(@Param("token") String token);

    Boolean updateLoginToken(@Param("po") LoginUserInfoPO po,@Param("newToken") String newToken);

    Boolean updateLoginFailCount(@Param("accountId") Long accountId);

    void updateAccountState(@Param("accountId") Long id,@Param("state") int state);

    /**
     * 定时任务mq  登录到达有效期  退出登录更新账户信息
     * @param accountId Long
     */
    void clearUserLoginState(@Param("accountId") Long accountId);

    String getUserNameById(@Param("userId") Long userId);

    /**
     * 更新用户信息
     * @param dto UpdateUserInfoDTO
     * @return boolean
     */
    boolean updateAccountInfoById(@Param("dto") UpdateUserInfoDTO dto);

    LoginUserInfoPO queryUserInfoById(@Param("accountId") Long accountId);

    List<CurrentUserInfoVO> getSysUserInfo(String content);
}
